/**
 * Copyright (c) 2010, "Shashank Tiwari"
 * web: www.shanky.org | www.treasuryofideas.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following
 *     disclaimer in the documentation and/or other materials provided
 *     with the distribution.
 *   * Neither the name of the fireclay-core project nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Created: Jun 8, 2010
 */

package fireclay.collection
{
	public interface IMap
	{
		/**
		 *  Remove all items (key/value) pairs from the Map.
		 * 
		 *  @param exceptKeys (optional) An optional <code>Array</code> of keys can be passed in
		 *  All items (key/values) pairs are removed except for those who's keys are specified in exceptKeys.
		 *
		 */
		function clear(...exceptKeys:Array):void;
		
		/**
		 *  Return <code>true</code> if key exists in the Map.
		 *
		 *  @param key The key who's existence is verified
		 *
		 *  @return <code>true</code> if key exists, <code>false</code> otherwise
		 *
		 */
		function containsKey(key:*):Boolean;
		
		
		/**
		 *  Return <code>true</code> if value exists in the Map.
		 *
		 *  @param value The value who's existence is verified
		 *
		 *  @return <code>true</code> if value exists, <code>false</code> otherwise
		 *
		 */
		function containsValue(value:*):Boolean;
		
		/**
		 *  Return value for the specified key.
		 *
		 *  @param key The key that maps to the value to be retrieved
		 *
		 *  @return value mapped to the specified key
		 *
		 */
		function get(key:*):*;
		
		/**
		 *  Return all keys that map to the specified value. Keys are unique in a Map but values are not
		 *  so a single value could map to more than one key.
		 *
		 *  @param value The value that the returned keys are mapped to
		 *
		 *  @return An <code>Array</code> of all keys that map to the specified value.
		 *  The <code>Array</code> is of length 1, if only one key maps to the specified value.
		 *
		 *  @see getValue
		 *
		 */
		function getKeys(value:*):Array;
		
		/**
		 *  Return value for the specified key.
		 *
		 *  @param key The key that maps to the value to be retrieved
		 *
		 *  @return value mapped to the specified key
		 *
		 */
		function getValue(key:*):*;
		
		/**
		 *  Return <code>true</code> if there are no key/value pairs in the Map.
		 *
		 *  @return <code>true</code> if the Map is empty, otherwise <code>false</code>
		 *
		 *  @see get
		 *
		 */
		function isEmpty():Boolean;
		
		/**
		 *  Return a collection of all keys in the Map.
		 *
		 *  @return An <code>Array</code> of all keys in the Map.
		 *
		 */
		function keys():Array;
		
		/**
		 *  Return value for the specified key and remove the key/value pair from the Map.
		 *
		 *  @param key The key that maps to the value to be retrieved
		 *
		 *  @return value mapped to the specified key
		 * 
		 *  @see get Returns value but does not remove it
		 *  @see getValue Same as get
		 *
		 */
		function pop(key:*):*;
		
		/**
		 *  Add a key/value pair to the Map.
		 *
		 *  @param key The key for the key/value mapping
		 *  @param value The value for the key/value mapping
		 *
		 */
		function put(key:*, value:*):void;
		
		/**
		 *  Add all key/value pairs in a specified <code>IMap</code>, <code>Object</code>
		 *  or <code>Dictionary</code> are added to the Map.
		 *
		 *  @param map A collection of key/value pairs, which could be an <code>IMap</code>,
		 *  an <code>Object</code> or a <code>Dictionary</code> instance.
		 *
		 */
		function putAll(map:*):void;
		
		/**
		 *  Remove the key/value pair for the specified key. Do nothing if the key doesn't exist.
		 *  
		 *  @param key The key corresponding to the key/value pair that is to be removed
		 *
		 */
		function remove(key:*):void;
		
		
		/**
		 *  Return a count of the total number of key/value pair entries in the Map.
		 *  
		 *  @return a count of key/value entries in the Map
		 *
		 */
		function size():int;
		
		/**
		 *  Add all key/value pairs in a specified <code>IMap</code>, <code>Object</code>
		 *  or <code>Dictionary</code> are added to the Map. Values for existing keys are overwritten,
		 *  unless they are optionally specified in the exceptKeys optional parameter.
		 *
		 *  @param map A collection of key/value pairs, which could be an <code>IMap</code>,
		 *  an <code>Object</code> or a <code>Dictionary</code> instance.
		 *  @param exceptKeys(optional) An optional <code>Array</code> of keys can be passed in
		 *  All items (key/values) pairs are updated except for those who's keys are specified in exceptKeys.
		 *
		 */
		
		function update(map:*, ...exceptKeys:Array):void;
		
		
		
		/**
		 *  Return a collection of all values in the Map.
		 *
		 *  @return An <code>Array</code> of all values in the Map.
		 *
		 */
		function values():Array;
		
	}
}